﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using BusinessLayer;

namespace PresentationLayer
{
    public partial class AdicionaActoObra : Form
    {
        public AdicionaActoObra()
        {
            InitializeComponent();
        }

        private void AdicionarButton_Click(object sender, EventArgs e)
        {
            this.IDActoTxtBox.SelectAll();
            this.IDObraTxtBox.SelectAll();
            this.IDOfic_TxtB.SelectAll();
            this.IdDep_txtB.SelectAll();

            String acto, ofic, obra, dep;
            if( (acto = this.IDActoTxtBox.SelectedText)== "" ||
                (ofic = this.IDOfic_TxtB.SelectedText) == "" || 
                (obra = this.IDObraTxtBox.SelectedText)== "" ||
                (dep = this.IdDep_txtB.SelectedText)== "" ) 
            {
                MessageBox.Show("Todos os dados são obrigados");
                return;
            }
            if (ActoActions.AdicionarActoObra(obra, acto, dep, ofic, ApplicationData.IdFuncionario+""))
                this.Close();
        }
    }
}
